#include <iostream>
#include <pthread.h>
#include <unistd.h>
std::string s = "aaaaaaaaaaaa";
void *newthreadrun(void *args)
{
    while (true)
    {
        std::cout << "I am new thread, pid: " << getpid()  << ", s : " << s << std::endl;
        sleep(1);
    }
}
int main()
{
    /*
    int pthread_create(pthread_t *__restrict__ __newthread, const pthread_attr_t *__restrict__ __attr, void *(*__start_routine)(void *), void *__restrict__ __arg)
    Create a new thread, starting with execution of START-ROUTINE
    getting passed ARG. Creation attributed come from ATTR. The new
    handle is stored in *NEWTHREAD.
    */
    pthread_t tid;
    pthread_create(&tid, nullptr, newthreadrun, nullptr);

    while (true)
    {
        std::cout << "I am main thread, pid: " << getpid() << std::endl;
        sleep(1);
    }

}
